package hbnu.stockManage;

import hbnu.stockManage.util.ConsoleIo;
import hbnu.stockManage.repository.ProductRepository;
import hbnu.stockManage.service.AuthService;
import hbnu.stockManage.service.ProductService;
import hbnu.stockManage.model.Product;


import java.util.List;
import java.util.Optional;

public class Main {
    public static void main(String[] args) {

        ConsoleIo io = new ConsoleIo();
        AuthService authService = new AuthService();

        io.readLine("请输入用户名：");
        io.readLine("请输入密码：");

        System.out.println("======================");
        System.out.println("  商品库存管理系统");
        System.out.println("======================");

        // 登录
        boolean authed = false;
        for (int i = 0; i < 3; i++) {
            String username = io.readLine("用户名: ");
            String password = io.readLine("密  码: ");
            if (authService.login(username, password)) {
                authed = true;
                break;
            }
            System.out.println("登录失败，请重试。（剩余次数：" + (2 - i) + ")");
        }
        if (!authed) {
            System.out.println("多次失败，程序退出。");
            return;
        }

    }

    }


